package java_thinking.unit_21._21_5;

/**
 * @Desc:   5-13    强制将未检查的 Throwable 转换为 RuntimeException
 * @author: cww
 * @DateTime: 2019/6/6 8:58
 */

public class LaunderThrowable {
    public static RuntimeException launderThrowable(Throwable t) {
        if (t instanceof RuntimeException) {
            return (RuntimeException) t;
        } else if (t instanceof Error) {
            throw (Error) t;
        } else {
            throw new IllegalArgumentException("Not unchecked ", t);
        }
    }
}
